<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
String path=request.getContextPath();
String uiPath=path+"/TopJUI";
%>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <!-- 避免IE使用兼容模式 -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <meta name="renderer" content="webkit">
    <!-- TopJUI框架样式 -->
    <link type="text/css" href="<%=uiPath %>/topjui/css/topjui.core.min.css" rel="stylesheet">
    <link type="text/css" href="<%=uiPath %>/topjui/themes/default/topjui.red.css" rel="stylesheet" id="dynamicTheme"/>
    <!-- FontAwesome字体图标 -->
    <link type="text/css" href="<%=uiPath %>/static/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet"/>
    <!-- layui框架样式 -->
    <link type="text/css" href="<%=uiPath %>/static/plugins/layui/css/layui.css" rel="stylesheet"/>
    <!-- jQuery相关引用 -->
    <script type="text/javascript" src="<%=uiPath %>/static/plugins/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="<%=uiPath %>/static/plugins/jquery/jquery.cookie.js"></script>
    <!-- TopJUI框架配置 -->
    <script type="text/javascript" src="<%=uiPath %>/static/public/js/topjui.config.js"></script>
    <!-- TopJUI框架核心-->
    <script type="text/javascript" src="<%=uiPath %>/topjui/js/topjui.core.min.js"></script>
    <!-- TopJUI中文支持 -->
    <script type="text/javascript" src="<%=uiPath %>/topjui/js/locale/topjui.lang.zh_CN.js"></script>
    <!-- layui框架js -->
    <script type="text/javascript" src="<%=uiPath %>/static/plugins/layui/layui.js" charset="utf-8"></script>
</head>

<body>
<!-- layout布局 开始 -->
<div data-toggle="topjui-layout" data-options="fit:true">
    <div data-options="region:'center',title:'',fit:false,split:true,border:false,bodyCls:'border_right_bottom'"
         style="height:60%">
        <!-- datagrid表格 -->
        <table data-toggle="topjui-datagrid"
               data-options="id:'userDg',
                        idField:'uuid',
                        treeField:'taskType',
                        pagination:true,
                        striped:true,
                        fitColumns:true,
                        rownumbers: true,
                        url:remoteHost+'/system/user/getPageSetData',
			            childTabs: [{id:'southTabs'}]">
        </table>
    </div>
    <div data-options="region:'south',fit:false,split:true,border:false"
         style="height:40%">
        <div data-toggle="topjui-tabs"
             data-options="id:'southTabs',
             fit:true,
             border:false,
             parentGrid:{
                 type:'datagrid',
                 id:'userDg',
                 param:'puuid:uuid,userNameId:userNameId,userName:userName'
             }">
            <!-- <div title="项目情况" data-options="id:'tab0',iconCls:'fa fa-th'">
                <div data-toggle="topjui-tabs"
			    	data-options="id:'southTabs',
			             fit:true,
			             border:false,
			             parentGrid:{
			                 type:'datagrid',
			                 id:'productXQDg',
			                 param:'puuid:uuid,userNameId:userNameId,userName:userName'
			             }">
				    <a id="addPS" href="javascript:void(0)">新增</a>
				    <a id="editPS" href="javascript:void(0)">编辑</a>
				    <a id="deletePS" href="javascript:void(0)">删除</a>
				</div>
                datagrid表格
                <table id="projectSituation"></table>
            </div> -->
            <div title="订单情况" data-options="id:'tab1',iconCls:'fa fa-th'">
                <div data-toggle="topjui-tabs"
			    	data-options="id:'southTabs',
			             fit:true,
			             border:false,
			             parentGrid:{
			                 type:'datagrid',
			                 id:'productXQDg',
			                 param:'puuid:uuid,userNameId:userNameId,userName:userName'
			             }">
				    <a id="addOS" href="javascript:void(0)">新增</a>
				    <a id="editOS" href="javascript:void(0)">编辑</a>
				    <a id="deleteOS" href="javascript:void(0)">删除</a>
				</div>
                <!-- datagrid表格 -->
                <table id="orderSituation"></table>
            </div>
            <div title="购买支出预算" data-options="id:'tab2',iconCls:'fa fa-th'">
                <div data-toggle="topjui-tabs"
			    	data-options="id:'southTabs',
			             fit:true,
			             border:false,
			             parentGrid:{
			                 type:'datagrid',
			                 id:'productXQDg',
			                 param:'puuid:uuid,userNameId:userNameId,userName:userName'
			             }">
				    <a id="addEB" href="javascript:void(0)">新增</a>
				    <a id="editEB" href="javascript:void(0)">编辑</a>
				    <a id="deleteEB" href="javascript:void(0)">删除</a>
				</div>
                <!-- datagrid表格 -->
                <table id="expenseBudget"></table>
            </div>
            <div title="核算分析" data-options="id:'tab3',iconCls:'fa fa-th'">
                <div data-toggle="topjui-tabs"
			    	data-options="id:'southTabs',
			             fit:true,
			             border:false,
			             parentGrid:{
			                 type:'datagrid',
			                 id:'productXQDg',
			                 param:'puuid:uuid,userNameId:userNameId,userName:userName'
			             }">
				    <a id="addAnalysis" href="javascript:void(0)">新增</a>
				    <a id="editAnalysis" href="javascript:void(0)">编辑</a>
				    <a id="deleteAnalysis" href="javascript:void(0)">删除</a>
				</div>
                <!-- datagrid表格 -->
                <table id="analysis"></table>
            </div>
        </div>
    </div>
</div>
<!-- layout布局 结束 -->

<!-- 表格工具栏开始 -->
<div id="userDg-toolbar" class="topjui-toolbar"
     data-options="grid:{
           type:'datagrid',
           id:'userDg'
       }">
    <form id="queryForm">
        <input type="text" name="name" data-toggle="topjui-textbox"
               data-options="id:'projectName',prompt:'项目名称'">
        <input type="text" name="code" data-toggle="topjui-textbox"
               data-options="id:'projectCode',prompt:'项目编号'">
        <a id="queryBtn" href="javascript:void(0)">查询</a>
    </form>
    <!-- <a id="add" href="javascript:void(0)">新增</a>
    <a id="edit" href="javascript:void(0)">编辑</a> -->
    <a id="add" href="javascript:void(0)">新增</a>
    <a id="delete" href="javascript:void(0)">删除</a>
    <a id="approval" href="javascript:void(0)">审批</a>
    <a id="unApproval" href="javascript:void(0)">撤销审批</a>
    <a id="export" href="javascript:void(0)">导出打印</a>
</div>
<!-- 表格工具栏结束 -->
</body>
<script>
    function progressFormatter(value, rowData, rowIndex) {
        var htmlstr = '<div id="p" data-toggle="topjui-progressbar progressbar" data-options="value:' + value + '" style="width: 398px; height: 26px;">';
        htmlstr += '<div class="progressbar-text" style="width: 398px; height: 26px; line-height: 26px;">' + value + '%</div>';
        htmlstr += '<div class="progressbar-value" style="width: ' + value + '%; height: 26px; line-height: 26px;">';
        htmlstr += '<div class="progressbar-text" style="width: 398px; height: 26px; line-height: 26px;">' + value + '%</div>';
        htmlstr += '</div>';
        htmlstr += '</div>';
        return htmlstr;
    }
    
    $(function () {
        var projectList = {
            type: 'datagrid',
            id: 'productDg'
        };

        $("#userDg").iDatagrid({
            id: 'userDg',
            url: '<%=path%>/TopJUI/json/product/budgetList.json',
            fitColumns: true,
            columns: [[
                {field: 'uuid', title: 'UUID', checkbox: true},
                {field: 'budgetCode', title: '预算单号', sortable: true},
                {field: 'clientName', title: '客户', sortable: true},
                {field: 'projectName', title: '项目名称', sortable: true},
                {field: 'projectDate', title: '日期', sortable: true},
                {field: 'projectManager', title: '项目经理', sortable: true},
                {field: 'approvalStatus', title: '审核状态', sortable: true},
                {field: 'approvalName', title: '审核人', sortable: true},
                {field: 'approvalDate', title: '审核日期', sortable: true},
            ]],
            onClickRow: function (index, row) {
            	$("#projectSituation").iDatagrid({
                    id: 'projectSituation',
                    url: '<%=path%>/TopJUI/json/product/projectSituationList.json',
                    fitColumns: true,
                    columns: [[
                        {field: 'uuid', title: 'UUID', checkbox: true},
                        {field: 'clientName', title: '客户名称', sortable: true},
                        {field: 'projectName', title: '项目名称', sortable: true},
                        {field: 'date', title: '文件日期', sortable: true},
                        {field: 'clientPurchasing', title: '客户采购', sortable: true},
                        {field: 'clientTechnical', title: '客户技术', sortable: true},
                        {field: 'projectCode', title: '项目编号', sortable: true},
                        {field: 'projectManager', title: '项目负责人', sortable: true},
                        {field: 'purchasingResponsibility', title: '采购负责', sortable: true},
                        {field: 'endDate', title: '项目交期', sortable: true},
                    ]]
                });
            	$("#orderSituation").iDatagrid({
                    id: 'orderSituation',
                    url: '<%=path%>/TopJUI/json/product/orderSituationList.json',
                    fitColumns: true,
                    columns: [[
                        {field: 'uuid', title: 'UUID', checkbox: true},
                        {field: 'projectName', title: '项目名称', sortable: true},
                        {field: 'model', title: '规格型号', sortable: true},
                        {field: 'unit', title: '单位', sortable: true},
                        {field: 'number', title: '数量', sortable: true},
                        {field: 'price', title: '单价', sortable: true},
                        {field: 'amount', title: '合计金额', sortable: true},
                        {field: 'note', title: '备注', sortable: true}
                    ]]
                });
            	$("#expenseBudget").iDatagrid({
                    id: 'expenseBudget',
                    url: '<%=path%>/TopJUI/json/product/expenseBudget.json',
                    fitColumns: true,
                    columns: [[
						{field: 'uuid', title: 'UUID', checkbox: true},
						{field: 'name', title: '名称', sortable: true},
						{field: 'model', title: '规格型号', sortable: true},
						{field: 'unit', title: '单位', sortable: true},
						{field: 'number', title: '数量', sortable: true},
						{field: 'price', title: '单价', sortable: true},
						{field: 'amount', title: '小计', sortable: true},
						{field: 'realPrice', title: '实采购价', sortable: true},
						{field: 'note', title: '备注', sortable: true}
                    ]]
                });
            	$("#analysis").iDatagrid({
                    id: 'analysis',
                    url: '<%=path%>/TopJUI/json/product/accountingAnalysis.json',
                    fitColumns: true,
                    columns: [[
                        {field: 'uuid', title: 'UUID', checkbox: true},
                        {field: 'name', title: '名称', sortable: true},
                        {field: 'model', title: '规格型号', sortable: true},
                        {field: 'number', title: '数量', sortable: true},
                        {field: 'totalSales', title: '销售总额', sortable: true},
                        {field: 'cost', title: '支出预算（成本）', sortable: true},
                        {field: 'inputTax', title: '进项税金', sortable: true},
                        {field: 'salesTax', title: '销项税金', sortable: true},
                        {field: 'managementCosts', title: '管理费', sortable: true},
                        {field: 'salesExpense', title: '销售费用营销费用', sortable: true},
                        {field: 'profit', title: '毛利润', sortable: true}
                    ]]
                });
            }
        });

        <%-- /* 新增*/
        $("#add").iMenubutton({
            event: 'openDialog',
            iconCls: 'fa fa-plus',
            dialog: {
                id: 'userAddDialog',
                height: 500,
                href: '<%=path%>/PAGES/hpf/ProjectBudget/budgetAdd.jsp',
                buttonsGroup: [
                    {
                        text: '保存',
                        url: _ctx + '/json/response/success.json',
                        iconCls: 'fa fa-plus',
                        handler: 'ajaxForm',
                        btnCls: 'topjui-btn-normal'
                    }
                ]
            }
        });
        
        /* 修改*/
        $("#edit").iMenubutton({
        	event: 'openDialog',
            iconCls: 'fa fa-pencil',
            btnCls: 'topjui-btn',
            grid: {
                type: 'datagrid',
                id: 'userDg'
            },
            dialog: {
                width: 950,
                height: 500,
                href: _ctx + '/html/complex/dialog_edit.html?uuid={uuid}',
                url: _ctx + '/json/product/detail.json?uuid={uuid}',
                buttonsGroup: [
                    {
                        text: '更新',
                        url: _ctx + '/json/response/success.json',
                        iconCls: 'fa fa-save',
                        handler: 'ajaxForm',
                        btnCls: 'topjui-btn'
                    }
                ]
            }
        }); --%>
        
        /* 新增*/
        $("#add").iMenubutton({
            event: 'openDialog',
            iconCls: 'fa fa-plus',
            dialog: {
                id: 'userAddDialog',
                height: 500,
                href: '<%=path%>/PAGES/hpf/ProjectBudget/projectSituationAdd.jsp',
                buttonsGroup: [
                    {
                        text: '保存',
                        url: _ctx + '/json/response/success.json',
                        iconCls: 'fa fa-plus',
                        handler: 'ajaxForm',
                        btnCls: 'topjui-btn-normal'
                    }
                ]
            }
        });
        
        /* 删除 */
        $("#delete").iMenubutton({
            event: 'doAjax',
            iconCls: 'fa fa-trash',
            btnCls: 'topjui-btn-normal',
            url:_ctx + '/json/response/success.json',
            grid: {uncheckedMsg:'请先勾选要删除的数据',param:'uuid:uuid,code:code'}
        });
        
        /*审批*/
        $("#approval").iMenubutton({
            event: 'doAjax',
            iconCls: 'fa fa-trash',
            btnCls: 'topjui-btn',
            url:_ctx + '/json/response/success.json',
            grid: {uncheckedMsg:'请先勾选要审批的数据',param:'uuid:uuid,code:code'}
        });
        
        /*撤销审批*/
        $("#unApproval").iMenubutton({
            event: 'doAjax',
            iconCls: 'fa fa-trash',
            btnCls: 'topjui-btn-normal',
            url:_ctx + '/json/response/success.json',
            grid: {uncheckedMsg:'请先勾选要撤销审批的数据',param:'uuid:uuid,code:code'}
        });
        
        /*导出*/
        $("#export").iMenubutton({
            event: 'export',
            btnCls: 'topjui-btn',
            url: _ctx + '/json/response/export.html'
        });
        
        /* 点击查询按钮 */
        $('#queryBtn').iMenubutton({
            event: 'query',
            iconCls: 'fa fa-search',
            btnCls: 'topjui-btn-danger',
            form: {id: 'queryForm'},
            grid: {type: 'datagrid', 'id': 'productDg'}
        });
        
        <%-- /* 新增项目情况*/
        $("#addPS").iMenubutton({
            event: 'openDialog',
            iconCls: 'fa fa-plus',
            dialog: {
                id: 'userAddDialog',
                height: 500,
                href: '<%=path%>/PAGES/hpf/ProjectBudget/projectSituationAdd.jsp',
                buttonsGroup: [
                    {
                        text: '保存',
                        url: _ctx + '/json/response/success.json',
                        iconCls: 'fa fa-plus',
                        handler: 'ajaxForm',
                        btnCls: 'topjui-btn-normal'
                    }
                ]
            }
        });
        
        /* 修改项目情况*/
        $("#editPS").iMenubutton({
        	event: 'openDialog',
            iconCls: 'fa fa-pencil',
            btnCls: 'topjui-btn',
            grid: {
                type: 'datagrid',
                id: 'userDg'
            },
            dialog: {
                width: 950,
                height: 500,
                href: _ctx + '/html/complex/dialog_edit.html?uuid={uuid}',
                url: _ctx + '/json/product/detail.json?uuid={uuid}',
                buttonsGroup: [
                    {
                        text: '更新',
                        url: _ctx + '/json/response/success.json',
                        iconCls: 'fa fa-save',
                        handler: 'ajaxForm',
                        btnCls: 'topjui-btn'
                    }
                ]
            }
        });
        
        /* 删除项目情况 */
        $("#deletePS").iMenubutton({
            event: 'doAjax',
            iconCls: 'fa fa-trash',
            btnCls: 'topjui-btn-normal',
            url:_ctx + '/json/response/success.json',
            grid: {uncheckedMsg:'请先勾选要删除的数据',param:'uuid:uuid,code:code'}
        }); --%>
        
        /* 新增订单情况*/
        $("#addOS").iMenubutton({
            event: 'openDialog',
            iconCls: 'fa fa-plus',
            dialog: {
                id: 'userAddDialog',
                height: 500,
                href: '<%=path%>/PAGES/hpf/ProjectBudget/orderSituationAdd.jsp',
                buttonsGroup: [
                    {
                        text: '保存',
                        /* url: _ctx + '/json/response/success.json', */
                        iconCls: 'fa fa-plus',
                        handler: 'ajaxForm',
                        btnCls: 'topjui-btn-normal'
                    }
                ]
            }
        });
        
        /* 修改订单情况*/
        $("#editOS").iMenubutton({
        	event: 'openDialog',
            iconCls: 'fa fa-pencil',
            btnCls: 'topjui-btn',
            grid: {
                type: 'datagrid',
                id: 'userDg'
            },
            dialog: {
                width: 950,
                height: 500,
                href: _ctx + '/html/complex/dialog_edit.html?uuid={uuid}',
                url: _ctx + '/json/product/detail.json?uuid={uuid}',
                buttonsGroup: [
                    {
                        text: '更新',
                        url: _ctx + '/json/response/success.json',
                        iconCls: 'fa fa-save',
                        handler: 'ajaxForm',
                        btnCls: 'topjui-btn'
                    }
                ]
            }
        });
        
        /* 删除订单情况 */
        $("#deleteOS").iMenubutton({
            event: 'doAjax',
            iconCls: 'fa fa-trash',
            btnCls: 'topjui-btn-normal',
            url:_ctx + '/json/response/success.json',
            grid: {uncheckedMsg:'请先勾选要删除的数据',param:'uuid:uuid,code:code'}
        });
        
        /* 新增购买支出预算*/
        $("#addEB").iMenubutton({
            event: 'openDialog',
            iconCls: 'fa fa-plus',
            dialog: {
                id: 'userAddDialog',
                height: 500,
                href: '<%=path%>/PAGES/hpf/ProjectBudget/expenseBudgetAdd.jsp',
                buttonsGroup: [
                    {
                        text: '保存',
                        url: _ctx + '/json/response/success.json',
                        iconCls: 'fa fa-plus',
                        handler: 'ajaxForm',
                        btnCls: 'topjui-btn-normal'
                    }
                ]
            }
        });
        
        /* 修改购买支出预算*/
        $("#editEB").iMenubutton({
        	event: 'openDialog',
            iconCls: 'fa fa-pencil',
            btnCls: 'topjui-btn',
            grid: {
                type: 'datagrid',
                id: 'userDg'
            },
            dialog: {
                width: 950,
                height: 500,
                href: _ctx + '/html/complex/dialog_edit.html?uuid={uuid}',
                url: _ctx + '/json/product/detail.json?uuid={uuid}',
                buttonsGroup: [
                    {
                        text: '更新',
                        url: _ctx + '/json/response/success.json',
                        iconCls: 'fa fa-save',
                        handler: 'ajaxForm',
                        btnCls: 'topjui-btn'
                    }
                ]
            }
        });
        
        /* 删除购买支出预算 */
        $("#deleteEB").iMenubutton({
            event: 'doAjax',
            iconCls: 'fa fa-trash',
            btnCls: 'topjui-btn-normal',
            url:_ctx + '/json/response/success.json',
            grid: {uncheckedMsg:'请先勾选要删除的数据',param:'uuid:uuid,code:code'}
        });
        
        /* 新增核算分析*/
        $("#addAnalysis").iMenubutton({
            event: 'openDialog',
            iconCls: 'fa fa-plus',
            dialog: {
                id: 'userAddDialog',
                height: 500,
                href: '<%=path%>/PAGES/hpf/ProjectBudget/analysisAdd.jsp',
                buttonsGroup: [
                    {
                        text: '保存',
                        url: _ctx + '/json/response/success.json',
                        iconCls: 'fa fa-plus',
                        handler: 'ajaxForm',
                        btnCls: 'topjui-btn-normal'
                    }
                ]
            }
        });
        
        /* 修改核算分析*/
        $("#editAnalysis").iMenubutton({
        	event: 'openDialog',
            iconCls: 'fa fa-pencil',
            btnCls: 'topjui-btn',
            grid: {
                type: 'datagrid',
                id: 'userDg'
            },
            dialog: {
                width: 950,
                height: 500,
                href: _ctx + '/html/complex/dialog_edit.html?uuid={uuid}',
                url: _ctx + '/json/product/detail.json?uuid={uuid}',
                buttonsGroup: [
                    {
                        text: '更新',
                        url: _ctx + '/json/response/success.json',
                        iconCls: 'fa fa-save',
                        handler: 'ajaxForm',
                        btnCls: 'topjui-btn'
                    }
                ]
            }
        });
        
        /* 删除 核算分析*/
        $("#deleteAnalysis").iMenubutton({
            event: 'doAjax',
            iconCls: 'fa fa-trash',
            btnCls: 'topjui-btn-normal',
            url:_ctx + '/json/response/success.json',
            grid: {uncheckedMsg:'请先勾选要删除的数据',param:'uuid:uuid,code:code'}
        });
        
    });

    // 自定义方法
    function myQuery() {
        // 提示信息
        $.iMessager.alert('自定义方法', '自定义方法被执行了！', 'messager-info');
        // 提交参数查询表格数据
        $('#productDg').iDatagrid('reload', {
            name: $('#name').iTextbox('getValue'),
            code: $('#code').iTextbox('getValue')
        });
    }
</script>
</html>